package com.cskaoyan.controller.wx;

import com.cskaoyan.model.admin.bo.BaseParam;
import com.cskaoyan.model.admin.vo.BaseData;
import com.cskaoyan.model.admin.vo.BaseRespVo;
import com.cskaoyan.model.vx.bo.CollectAddordelete;
import com.cskaoyan.service.wx.WxCollectByChenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @Author: ChenZhuqi
 * @Date: 2021/12/3 16:21
 * @Description: 收藏模块
 */
@RestController
public class WxCollectByChenController {
    @Autowired
    WxCollectByChenService collectService;
     /**
      * @Author ChenZhuqi
      * @Date 2021/12/3 16:24
      * @Description： 当没有登录时，点击收藏会显示该请求
      */
    @RequestMapping("wx/collect/addordelete")
    public BaseRespVo collectAddordelete(@RequestBody CollectAddordelete collectAddordelete, HttpSession session){

        //return BaseRespVo.fail(501,"请登录");
       int i = collectService.Addordelete(collectAddordelete,session);
       if (i==1){
           return BaseRespVo.ok("成功");
       }
       return BaseRespVo.fail(501,"请登录");

    }
    @RequestMapping("wx/collect/list")
    public BaseRespVo collectList(Byte type, Integer page, Integer limit,HttpSession session){
        BaseData data=collectService.collectList(type,page,limit,session);
        return BaseRespVo.ok(data);
    }
}
